<?php


class LogWriter{
	
	static private $_instance;
	
	public static function getInstance() {
		if (is_null(self::$_instance)) {
			self::$_instance = new self();
		}
		return self::$_instance;
	}
	
	public function log($p_sController,$p_sError)
	{
		$_sTimestamp = time();;
		$_sLocation = $p_sController;
		$_sError = $p_sError;
	
		$_sLogURL = LOG_ROOT . $p_sController .'.log';
		$_sMessage = ">" . $_sTimestamp . " - " . $_sError . "\n";
		
		if(!is_writable($_sLogURL)){ 'print log cant be written'; }
		
		$logfile = fopen($_sLogURL,'a') or die('kan logfile niet openen/aanmaken');
		fputs($logfile,$_sMessage,strlen($_sMessage));
		fclose($logfile);
	}
	
}
?>